# -*- coding: utf-8 -*-
"""
# @Time    : 2021/1/9 下午4:49
# @Author  : tgy
"""
import random


def test01():
    ...
    # [0,1)
    print(random.random())
    # [1,10]直接的整数
    print(random.randint(1, 10))
    print(random.randrange(1, 10))
    # 选取可迭代对象内的任意一个值
    print(random.choice([1, 2, 3, 4, 5]))

    print(random.sample([1, 2, 3, 4, 5], 2))
    # [1,3)之间的float
    print(random.uniform(1, 3))
    nums = [1, 2, 3, 4, 5]
    random.shuffle(nums)
    print(nums)


def check_code(size=4):
    ...
    res = ''
    choice_eles = [chr(c) for c in range(97,123)] + [chr(c) for c in range(65, 91)] + [str(n) for n in range(0,10)]
    print(choice_eles)
    return ''.join(random.sample(choice_eles, size))


if __name__ == '__main__':
    ...
    test01()
    print(check_code())